package game.Config;

import game.Wave;

import java.util.ArrayList;

/**
 * This class contains all the wave information
 * @author Sebastian Isheden and Victor Beer
 *
 */
public class WaveConfig {
	private static ArrayList<Wave> waves = new ArrayList<Wave>();
	public static final float DOWN_TIME = 2;
	
	private final static float BASIC_ENEMY_SPEED = 50f;
	private final static EnemyInfo BASIC_ENEMY_HP1 = new EnemyInfo(Config.basicEnemyImage,1,BASIC_ENEMY_SPEED,Config.deathSheet);
	private final static EnemyInfo BASIC_ENEMY_HP2 = new EnemyInfo(Config.basicEnemyImage,2,BASIC_ENEMY_SPEED,Config.deathSheet);
	private final static EnemyInfo BASIC_ENEMY_HP5 = new EnemyInfo(Config.basicEnemyImage,5,BASIC_ENEMY_SPEED,Config.deathSheet);
	private final static EnemyInfo BASIC_ENEMY_HP10 = new EnemyInfo(Config.basicEnemyImage,10,BASIC_ENEMY_SPEED,Config.deathSheet);	
	private final static EnemyInfo BASIC_ENEMY_HP20 = new EnemyInfo(Config.basicEnemyImage,20,BASIC_ENEMY_SPEED,Config.deathSheet);	
	private final static EnemyInfo BASIC_ENEMY_HP30 = new EnemyInfo(Config.basicEnemyImage,30,BASIC_ENEMY_SPEED,Config.deathSheet);	
	private final static EnemyInfo BASIC_ENEMY_HP40 = new EnemyInfo(Config.basicEnemyImage,40,BASIC_ENEMY_SPEED,Config.deathSheet);
	private final static EnemyInfo BASIC_ENEMY_HP50 = new EnemyInfo(Config.basicEnemyImage,50,BASIC_ENEMY_SPEED,Config.deathSheet);	
	
	
	private final static float FAST_ENEMY_SPEED = 100f;
	private final static EnemyInfo FAST_ENEMY_HP1 = new EnemyInfo(Config.basicEnemyImage,1,FAST_ENEMY_SPEED,Config.deathSheet);
	private final static EnemyInfo FAST_ENEMY_HP5 = new EnemyInfo(Config.basicEnemyImage,5,FAST_ENEMY_SPEED,Config.deathSheet);
	
	private final static float BOSS_ENEMY_SPEED = 25f;;
	private final static EnemyInfo BOSS_ENEMY_HP5 = new EnemyInfo(Config.basicEnemyImage,5,BOSS_ENEMY_SPEED,Config.deathSheet);
	private final static EnemyInfo BOSS_ENEMY_HP50 = new EnemyInfo(Config.basicEnemyImage,50,BOSS_ENEMY_SPEED,Config.deathSheet);
	private final static EnemyInfo BOSS_ENEMY_HP150 = new EnemyInfo(Config.basicEnemyImage,150,BOSS_ENEMY_SPEED,Config.deathSheet);
	/**
	 * Initializes the waves.
	 */
	public static void initialize(){
		if(Config.testing){
			initializeTestWave();
			
		} else {
			initializeWave1();
			initializeWave2();
			initializeWave3();
			initializeWave4();
			initializeWave5();
			initializeWave6();
			initializeWave7();
			initializeWave8();
			initializeWave9();
			initializeWave10();
			initializeWave11();
			initializeWave12();
		}

		
	}
	
	private static void initializeTestWave(){
		float spawnInterval = 0.1f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BOSS_ENEMY_HP150, 100);
		waves.add(wave);
	}
	private static void initializeWave1(){
		float spawnInterval = 0.75f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BASIC_ENEMY_HP1, 25);
		waves.add(wave);
		
	}
	private static void initializeWave2(){
		float spawnInterval = 0.75f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BASIC_ENEMY_HP1, 25);
		wave.addEnemy(BASIC_ENEMY_HP2, 5);
		waves.add(wave);
		
	}
	private static void initializeWave3(){
		float spawnInterval = 0.75f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BASIC_ENEMY_HP1, 25);
		wave.addEnemy(BASIC_ENEMY_HP2, 5);
		wave.addEnemy(BOSS_ENEMY_HP5, 2);

		waves.add(wave);
		
	}
	private static void initializeWave4(){
		float spawnInterval = 0.75f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BASIC_ENEMY_HP1, 25);
		wave.addEnemy(BASIC_ENEMY_HP2, 7);
		wave.addEnemy(FAST_ENEMY_HP1, 15);
		waves.add(wave);
		
	}
	private static void initializeWave5(){
		float spawnInterval = 0.7f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BASIC_ENEMY_HP1, 30);
		wave.addEnemy(BASIC_ENEMY_HP2, 15);
		wave.addEnemy(BASIC_ENEMY_HP5, 5);
		waves.add(wave);
		
	}
	private static void initializeWave6(){
		float spawnInterval = 0.5f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BOSS_ENEMY_HP5, 20);
		wave.addEnemy(BASIC_ENEMY_HP2, 35);
		waves.add(wave);
	}
	private static void initializeWave7(){
		float spawnInterval = 0.5f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BASIC_ENEMY_HP1, 50);
		wave.addEnemy(BASIC_ENEMY_HP2, 10);
		wave.addEnemy(BASIC_ENEMY_HP5, 10);
		wave.addEnemy(FAST_ENEMY_HP1, 25);
		waves.add(wave);
		
	}
	private static void initializeWave8(){
		float spawnInterval = 0.10f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BASIC_ENEMY_HP1, 250);
		wave.addEnemy(FAST_ENEMY_HP1, 100);

		waves.add(wave);
		
	}
	private static void initializeWave9(){
		float spawnInterval = 0.33f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BASIC_ENEMY_HP1, 75);
		wave.addEnemy(FAST_ENEMY_HP1, 75);
		wave.addEnemy(BASIC_ENEMY_HP2, 50);
		wave.addEnemy(BASIC_ENEMY_HP5, 15);
		waves.add(wave);
		
	}
	private static void initializeWave10(){
		float spawnInterval = 0.5f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BASIC_ENEMY_HP1, 50);
		wave.addEnemy(FAST_ENEMY_HP5, 5);
		wave.addEnemy(BASIC_ENEMY_HP10, 20);
		waves.add(wave);
		
	}
	private static void initializeWave11(){
		float spawnInterval = 0.5f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(FAST_ENEMY_HP1, 100);
		wave.addEnemy(FAST_ENEMY_HP5, 20);
		waves.add(wave);
	}
	
	private static void initializeWave12(){
		float spawnInterval = 0.5f;
		Wave wave = new Wave(spawnInterval);
		wave.addEnemy(BASIC_ENEMY_HP2, 50);
		wave.addEnemy(BASIC_ENEMY_HP5, 40);
		wave.addEnemy(FAST_ENEMY_HP1, 100);
		wave.addEnemy(FAST_ENEMY_HP5, 20);
		waves.add(wave);
	}

	
	/**
	 * Returns a copy of all the waves.
	 * @return A copy of all hte waves.
	 */
	public static ArrayList<Wave> getWaves(){
		ArrayList<Wave> returnWaves = new ArrayList<Wave>();
		for(Wave wave: waves){
			returnWaves.add(wave.copy());
		}
		return returnWaves;
	}

}
